<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
<%@ taglib prefix="portlet" uri="http://java.sun.com/portlet" %>

<portlet:defineObjects/>

<link href="/Todo-portlet/css/todo.css" rel="stylesheet" type="text/css" />

<table width="100%">
    <tr><td align="right" valign="middle">
            <div id="menu">
                <portlet:renderURL var="todosUrl">
                    <portlet:param name="action" value="todos"/>
                </portlet:renderURL>

                <portlet:renderURL var="editUrl">
                    <portlet:param name="action" value="editTodo"/>
                    <portlet:param name="todoId" value="${todo.id}"/>
                </portlet:renderURL>

                <portlet:actionURL var="deleteUrl">
                    <portlet:param name="action" value="deleteTodo"/>
                    <portlet:param name="todoId" value="${todo.id}"/>
                </portlet:actionURL>

                &#091;<a href="${todosUrl}">Back</a>&#093;&nbsp;
                &#091;<a href="${editUrl}">Edit todo</a>&#093;&nbsp;
                &#091;<a href="${deleteUrl}">Delete todo</a>&#093;
            </div>
        </td>
    </tr>
    <tr>
        <td>
            <table width="100%">
                <tr><td colspan="2"><h3 class="title">${todo.title}</h3></td></tr>
                <tr><td><b>Status:&nbsp;</b></td><td><input type="checkbox" disabled="disabled" ${todo.done ? 'checked' : ''}/></td></tr>
                <tr><td><b>Priority&nbsp;</b></td>
                    <td>
                        <c:choose>
                            <c:when test="${todo.priority == 1}">High</c:when>
                            <c:when test="${todo.priority == 2}">Medium</c:when>
                            <c:otherwise>Low</c:otherwise>
                        </c:choose>
                    </td>
                </tr>
                <tr><td><b>Creator:&nbsp;</b></td><td>${todo.ownerScreenName}</td></tr>
                <tr><td><b>Creation date:&nbsp;</b></td><td>${todo.creationDate}</td></tr>
                <tr><td><b>Due date:&nbsp;</b></td><td>${todo.dueDate}</td></tr>
                <tr><td><b>Category:&nbsp;</b></td><td>${todo.category.name}</td></tr>
                <tr><td valign="top"><b>Description:&nbsp;</b></td><td><textarea style="width:98%;" rows="5" readonly="true">${todo.description}</textarea></td></tr>
            </table>
       </td>
    </tr>
</table>
